<template>
    <div class="xuexiziliao-detail" v-loading="loading">
        <div>
            <e-container>
                <div class="title-modelbox-widget1">
                    <h3 class="section-title">资料详情</h3>
                    <div class="sidebar-widget-body">
                        <div class="news-info">
                            <h3 class="title" v-text="map.ziliaomingcheng"></h3>
                            <div class="descount">
                                <span class="title"> 资料编号： {{ map.ziliaobianhao }} </span>
                                <span class="title">
                                    资料类型：
                                    <e-select-view module="ziliaoleixing" :value="map.ziliaoleixing" select="id" show="leixingmingcheng"></e-select-view>
                                </span>
                                <span class="title"> 专业： {{ map.zhuanye }} </span>
                                <span class="title">
                                    资料附件：
                                    <e-file-list v-model="map.ziliaofujian"></e-file-list>
                                </span>
                                <span class="title"> 点击率： {{ map.dianjilv }} </span>
                                <span class="title"> 发布人： {{ map.faburen }} </span>
                            </div>
                            <div class="content" v-html="map.ziliaoneirong"></div>
                        </div>
                    </div>
                    <!-- /.sidebar-widget-body -->
                </div>
            </e-container>
        </div>
        <div>
            <e-container>
                <div class="title-modelbox-widget1">
                    <h3 class="section-title">评论区</h3>
                    <div class="sidebar-widget-body">
                        <e-comments module="xuexiziliao" :lists="comments" :biaoti="map.ziliaomingcheng" user="yonghu" headimg="touxiang" :is-reply="true" name="yonghuming">
                        </e-comments>
                    </div>
                    <!-- /.sidebar-widget-body -->
                </div>
            </e-container>
        </div>
    </div>
</template>
<style type="text/scss" scoped lang="scss"></style>
<script>
    import api from "@/api";
    import { extend } from "@/utils/extend";
    import jdk from "@/utils/extend";
    export default {
        data() {
            return {
                loading: false, // 加载

                map: {
                    ziliaobianhao: "",
                    ziliaomingcheng: "",
                    ziliaoleixing: "",
                    zhuanye: "",
                    ziliaotupian: "",
                    ziliaofujian: "",
                    ziliaoneirong: "",
                    dianjilv: "",
                    faburen: "",
                    addtime: "",
                },
                comments: [],
            };
        },
        props: {
            id: {
                type: [String, Number],
                required: true,
            },
        },
        watch: {
            id: {
                handler() {
                    this.loadDetail();
                },
                immediate: true,
            },
        },
        computed: {},
        methods: {
            loadDetail() {
                if (this.loading) return;
                this.loading = true;
                this.$get(api.xuexiziliao.webdetail, {
                    id: this.id,
                })
                    .then((res) => {
                        this.loading = false;
                        if (res.code == api.code.OK) {
                            extend(this, res.data);
                        } else {
                            this.$message.error(res.msg);
                        }
                    })
                    .catch((err) => {
                        this.loading = false;
                        this.$message.error(err.message);
                    });
            },
        },
        created() {},
        mounted() {},
        destroyed() {},
    };
</script>
